package com.leadingsoft.pwxk.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.leadingsoft.pwxk.converter.AreaConverter;
import com.leadingsoft.pwxk.dto.AreaDto;
import com.leadingsoft.pwxk.model.Area;
import com.leadingsoft.pwxk.repository.AreaRepository;
import com.leadingsoft.pwxk.service.AreaService;

@Service
public class AreaServiceImpl implements AreaService {
	@Autowired
	private AreaRepository repository;
	@Autowired
	private AreaConverter converter;

	@Override
	public AreaDto get(String dataid) {
		// TODO Auto-generated method stub
		return null;
	}

//	@Cacheable(cacheNames = "codeArea", sync = true, key = "'all'")
	@Override
	public List<AreaDto> getAll() {
		List<Area> list = repository.findAll();
		return converter.toDto(list);
	}

	@Override
	public AreaDto getByAreaId(String areaId) {
		Area area = repository.findByAreaId(areaId);
		return converter.toDto(area);
	}

}
